from django.core.files.storage import Storage
from django.conf import settings


# 1:自定义的文件存储后端要继承django默认的存储后端Storage
class FastDFSStorage(Storage):

    def _open(self, name, mode="rb" ):
        # 打开django本地文件
        pass

    def _save(self, name, content, max_length=None):
        # 上传图片
        pass

    def url(self, name):
        # 返回"http://image.meiduo.site:8888/" + 图片在数据库中存储的地址
        return settings.FDFS_BASE_URL + name